/**
  ******************************************************************************
  * @file    AT25DF041.h
  * @author  Thongnh
  * @version V1.0
  * @date    18-07-2011
  * @brief   Main process of Flash AT25DF041
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, XICUTELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 Xicutelectronics</center></h2>
  ******************************************************************************
  */ 

#ifndef __CONFIG_H__
#define __CONFIG_H__

#include "BasicTypes.h"


class cConfig
{
private:
    static const U32 CONFIG_BLOCK_ADDR = 0x00000000;
    static const U32 CONFIG_BLOCK_SIZE = 0x00000000;

public:
    #define DEFAULT_ID                      ("16")
    static const U8  DEFAULT_MAC_ADDR_0     = 0x00;
    static const U8  DEFAULT_MAC_ADDR_1     = 0x04;
    static const U8  DEFAULT_MAC_ADDR_2     = 0xA3;
    static const U8  DEFAULT_MAC_ADDR_3     = 'T';
    static const U8  DEFAULT_MAC_ADDR_4     = 'h';
    static const U8  DEFAULT_MAC_ADDR_5     = 0x16;

    static const U8  DEFAULT_IP_ADDR_0      = 192;
    static const U8  DEFAULT_IP_ADDR_1      = 168;
    static const U8  DEFAULT_IP_ADDR_2      = 0;
    static const U8  DEFAULT_IP_ADDR_3      = 216;

    static const U16 DEFAULT_PORT           = 4567;

    static const U16  DEFAULT_LED_TIME_ON   = 1000;
    
    static const U16 DEFAULT_TOTAL_USER     = 0;

    static const U8 TIME_ZONE_MAX     = 16;

private:
    typedef struct
    {
        U16 m_pTimeZoneStart[TIME_ZONE_MAX];
        U16 m_pTimeZoneEnd[TIME_ZONE_MAX];
        U32 m_LEDOnTime;
        U8  m_IP[4];
        U16 m_Port;
        U16 m_TotalUser;
    } sConfig;


private:
    static sConfig s_Config;

private:
    static bool SaveConfig();
    static bool LoadConfig();

public:
    static void InitReset(void);
    static void GetTimeZone(U16 *pTimeZoneStart, U16 *pTimeZoneEnd);
    static void SetTimeZone(U16 *pTimeZoneStart, U16 *pTimeZoneEnd);
    static U8   GetLedTimeOn();
    static void SetLedTimeOn(U8 iLedTimeOn);
    static void GetIPConfig(U8* pIP, U16 &iPort);
    static void SetIPConfig(U8* pIP, U16 iPort);
    static U16  GetTotalUser();
    static void SetTotalUser(U16 iTotalUser);
};

#endif
// end of file

